package com.lyz.controller;

import com.lyz.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService service;

    @RequestMapping("{userId}/{productId}/{count}")
    public Boolean createOrder(@PathVariable("userId")String userId,
                               @PathVariable("productId")String productId,
                               @PathVariable("count")Integer count,
                               @RequestParam("userKey")String userKey,
                               @CookieValue("token")String token){
        System.out.println("userKey = " + userKey);
        System.out.println("token = " + token);
        return service.saveOrder(userId, productId, count);
    }
}
